<template>
  <page-tab-list
    url="/SyDangerCheckTaskDetail/GetHiddenDangerPageData"
    :params="params"
    @initList="_initList"
    ref="page"
  >
    <van-cell class="card" v-for="(item, index) in list" :key="index">
      <div class="warn_item">
        <div @click="goDetail(item)">
          <div class="f14">
            <div>{{ index + 1 }}、隐患描述：{{ item.HiddenDangerDesc }}</div>
          </div>
          <van-row gutter="20" class="dep_sort">
            <van-col span="24">
              <img
                src="@/assets/Images/AppIcon/icon_list_area.png"
                class="icon"
              />{{ item.HiddenDangerArea || "暂无区域" }}</van-col
            >
          </van-row>
          <van-row gutter="20" class="dep_sort">
            <van-col span="10">
              <img
                src="@/assets/Images/AppIcon/icon_list_user.png"
                class="icon"
              />{{ item.CreateChnName }}</van-col
            >
            <van-col span="14">
              <img
                src="@/assets/Images/AppIcon/icon_list_date.png"
                class="icon"
              />{{ item.CreateDate | formatDateTime }}</van-col
            >
          </van-row>
        </div>
      </div>
    </van-cell>
  </page-tab-list>
</template>

<script>
import PageTabList from "@/components/PageTabList/PageTabList.vue";

export default {
  components: { PageTabList },
  data() {
    return {
      list: [],
      params: [
        {
          dataType: "ToBeCorrectived",
          title: "待整改",
        },
        {
          dataType: "BeCorrectived",
          title: "已整改",
        },
      ],
    };
  },
  methods: {
    _initList(list) {
      this.list = list;
    },
    goDetail(item) {
       if (this.$refs.page.active == 0) {
        this.$router.push({
          path: "/SytechDanger/MyCorrectivedDetail",
          query: { id: item.ID },
        });
      } else {
        this.$router.push({
          path: "/SytechDanger/DangerCheckDetailView",
          query: { id: item.ID, type: "correctived" },
        });
      }
    },
  },
};
</script>